package view.hero
{
	import core.Language;
	
	import flash.display.MovieClip;
	
	import framework.proxy.ComponentProxy;
	
	import values.avatar.AvatarValue;
	import values.common.IAvatarProperty;
	
	import view.component.button.LabelChangeButtonProxy;
	
	public class HeroPropertyDetailProxy extends ComponentProxy
	{
		public function HeroPropertyDetailProxy()
		{
			super();
		}
		
		override protected function get proxyMapping():Array
		{
			return [{skin:"backBtn" , id:"backBtn" , classRef:LabelChangeButtonProxy , onClick:onBackClick , text:Language.getText("@back_label")}];
		}
		
		private function onBackClick():void
		{
			this.visible = false;
		}
		
		override public function parse(target:MovieClip):void
		{
			super.parse(target);
			skin.detailTF.text = Language.getText("@detail_property_label");
			skin.normalAttactConstTF.text = Language.getText("@property_normalDamage_name");
			skin.normalDeConstTF.text = Language.getText("@property_normalDefense_name");
			skin.skillAtConstTF.text = Language.getText("@property_skillDamage_name");
			skin.skillDeConstTF.text = Language.getText("@property_skillDefense_name");
			skin.elementAtConstTF.text = Language.getText("@property_elementDamage_name");
			skin.elementDeConstTF.text = Language.getText("@property_elementDefense_name");
			skin.hitConstTF.text = Language.getText("@property_hitRate_name");
			skin.dodgoConstTF.text = Language.getText("@property_dodgeRate_name");
			skin.throConstTF.text = Language.getText("@property_penetrateRate_name");
			skin.risitConstTF.text = Language.getText("@property_resistRate_name");
			skin.forceConstTF.text = Language.getText("@property_enforceRate_name");
			skin.blockConstTF.text = Language.getText("@property_blockRate_name");
			skin.critConstTF.text = Language.getText("@property_critRate_name");
			skin.passConstTF.text = Language.getText("@property_toughness_name");
		}
		
		private var vo:AvatarValue;
		
		public function set data(value:IAvatarProperty):void
		{
			vo = value as AvatarValue;
			update();
		}
		
		public function update():void
		{
			skin.normalAttactTF.text = vo.normalDamage;
			skin.normalDeTF.text = vo.normalDefense;
			skin.skillAtTF.text = vo.skillDamage;
			skin.skillDeTF.text = vo.skillDefense;
			skin.elementAtTF.text = vo.elementDamage;
			skin.elementDeTF.text = vo.elementDefense;
			skin.hitTF.text = vo.hitRate;
			skin.dodgoTF.text = vo.dodgeRate;
			skin.throTF.text = vo.penetrateRate;
			skin.risitTF.text = vo.resistRate;
			skin.forceTF.text = vo.enforceRate;
			skin.blockTF.text = vo.blockRate;
			skin.critTF.text = vo.critRate;
			skin.passTF.text = vo.toughness;
		}
	}
}